// package prime;

public class PrimeNumber {
    public void generate(int number) {
        System.out.println("prime number:");
        for (int i=1; i<=number;i++) {
            if (isPrime(i))
                System.out.print(i+" ");
        }
    }

    public  boolean isPrime(int n) {
        if(n > 2 && (n & 1) == 0)
            return false;
        for(int i = 3; i * i <= n; i += 2)
            if (n % i == 0)
                return false;
        return true;
    }
}
